home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / recipe.dxr / 00021_Draggable window.ls < prev    next >
Encoding:
Text File  |  2000-03-23  |  1.1 KB  |  49 lines

  1. property pDragging, startH, startV, startRect, thisWindow, lastMouseH, lastMouseV
  2.  
  3. on mouseDown
  4.   global gPauseState, gDragRect
  5.   if paused() then
  6.     alertBeep()
  7.     exit
  8.   end if
  9.   pDragging = 1
  10.   startH = (the clickLoc)[1]
  11.   startV = (the clickLoc)[2]
  12.   thisWindow = the activeWindow
  13.   startRect = thisWindow.rect
  14. end
  15.  
  16. on exitFrame
  17.   lastMouseH = the mouseH
  18.   lastMouseV = the mouseV
  19.   if paused() then
  20.     pDragging = 0
  21.     exit
  22.   end if
  23.   if pDragging then
  24.     if the stillDown then
  25.       newRect = offset(startRect, the mouseH - startH, the mouseV - startV)
  26.       if thisWindow <> the stage then
  27.         tell the stage
  28.           checkElapsedTime()
  29.           move_dummy(thisWindow, newRect)
  30.         end tell
  31.       end if
  32.       lastMouseH = the mouseH
  33.       lastMouseV = the mouseV
  34.     else
  35.       newRect = offset(startRect, lastMouseH - startH, lastMouseV - startV)
  36.       if thisWindow <> the stage then
  37.         tell the stage
  38.           drop_window(thisWindow, newRect)
  39.         end tell
  40.       end if
  41.       pDragging = 0
  42.     end if
  43.   end if
  44. end
  45.  
  46. on stopDragging me
  47.   pDragging = 0
  48. end
  49.